package sk.stuba.fiit.team14.game.comm;


import sk.stuba.fiit.team14.game.R;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class CommPrototypeActivity extends Activity {
    
	Button b; 
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.comm_prototype);
            
        b = (Button) findViewById(R.id.button1);
        b.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				Intent i = new Intent(getApplicationContext(), MultiplayerBluetoothExample.class);
				startActivity(i);
			}
		});
        
        b = (Button) findViewById(R.id.button2);
        b.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				Intent i = new Intent(getApplicationContext(), MultiplayerExample.class);
				startActivity(i);
			}
		});
    
        
        b = (Button) findViewById(R.id.button3);
        b.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				Intent i = new Intent(getApplicationContext(), MultiplayerServerDiscoveryExample.class);
				startActivity(i);
			}
		});
        
        b = (Button) findViewById(R.id.button4);
        b.setOnClickListener(new OnClickListener() {			
			public void onClick(View v) {
				Intent i = new Intent(getApplicationContext(), HessDroidClientActivity.class);
				startActivity(i);
			}
		});
        
        Account[] accountsByType = AccountManager.get(this).getAccountsByType(null);
        TextView t = (TextView) findViewById(R.id.textView1);
        StringBuilder sb = new StringBuilder();
        
        for(Account a : accountsByType) {
        	sb.append(a.name);
        	sb.append(" - ");
        	sb.append(a.type);
        	sb.append("\n");
        }
        
        WifiManager wm = (WifiManager) this.getSystemService(Context.WIFI_SERVICE);
        sb.append(wm.getConnectionInfo().getSSID());
 
        t.setText(sb.toString());
        
    }
}